package com.example.work01.controller;


import com.example.work01.entity.Type;
import com.example.work01.service.TypeService;
import com.example.work01.vo.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 分类表 前端控制器
 * </p>
 *
 * @author myb
 * @since 2023-10-01
 */
@Api(tags = "分类管理")
@RestController
@RequestMapping("/type")
@RequiredArgsConstructor
public class TypeController {
    private final TypeService typeService;

    /**
     * 查询所有类型
     * @return
     */
    @ApiOperation("查询所有类型")
    @GetMapping("/findAll")
    public AjaxResult findAll() {
        List<Type> typeList = typeService.list();
        return AjaxResult.success(typeList);
    }
}
